import javax.swing.*;

public class SentinelUsingConfirmationDialog {
    public static void main(String[] args) {
        int sum = 0;
        int option = JOptionPane.YES_OPTION;
        String s;
        
        while(option == JOptionPane.YES_OPTION) {
            s = JOptionPane.showInputDialog(null,
                    "Ievadi skaitli: ", "Cikls", JOptionPane.QUESTION_MESSAGE);
            int data = Integer.parseInt(s);
            sum += data;
            option = JOptionPane.showConfirmDialog(null, "Turpināt?", null,
                    JOptionPane.YES_NO_OPTION);
        }
        
        JOptionPane.showMessageDialog(null, "Summa ir vienāda ar " + sum);
    }
}